package com.gjintel.auction.business.dao.daoImpl;

/**
 * Created by Administrator on 2017/11/24.
 */

import com.gjintel.auction.business.dao.IDicStatusDao;
import com.gjintel.auction.business.model.AuctionInfo;
import com.gjintel.auction.business.model.DicStatus;
import com.gjintel.sdk.base.dao.HibernateGenericDAO;
import com.gjintel.sdk.base.dao.Page;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class DicStatusDaoImpl extends HibernateGenericDAO implements IDicStatusDao {

    @Override
    public DicStatus findOneByCode(String code) {
        List<Object> params = new ArrayList<Object>();
        String hql = "from DicStatus ds where ds.code = ?";
        params.add(code);
        Page page = new Page();
        page.setPageNo(1);
        page.setPageSize(1);
        List<DicStatus> dicStatusList = this.findAsPage(hql, page, params.toArray());
        if (dicStatusList == null || dicStatusList.size() <= 0) {
            return null;
        }
        return dicStatusList.get(0);
    }
}
